'use strict';

/**
 * @ngdoc function
 * @name nodeApp.controller:ArticleCtrl
 * @description
 * # ArticleCtrl
 * Controller of the nodeApp
 */
app.controller('ArticleCtrl', function ($scope,$http,$stateParams,$timeout) {
  $scope.article_id=$stateParams.id;
  $http.get('/article/'+$stateParams.id).then(function(res){
    var key;
    //log(res.data)
    for(key in res.data){
      $scope[key]=res.data[key];
    }
    $scope.$broadcast('finish-load-article');
    $timeout(function (){
      SyntaxHighlighter.highlight();
    });
  });
});
